package com.tansun.easycare.rule.datamodel.service;

import java.util.List;
import java.util.Map;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import com.tansun.easycare.rule.common.ReferenceModel;
import com.tansun.easycare.rule.common.ResMessage;
import com.tansun.easycare.rule.common.service.RuleBaseService;
import com.tansun.easycare.rule.datamodel.entity.RuleDatamodel;
import com.tansun.easycare.rule.datamodel.entity.RuleDataset;
import com.tansun.easycare.rule.datamodel.model.DataSourceVo;
import com.tansun.easycare.rule.exception.BizException;

public interface DataModelService extends RuleBaseService<RuleDataset> {
    public PageInfo<RuleDataset> findDatasetForMove(RuleDataset ruleDataset);

    public PageInfo<ReferenceModel> findReferenceData(Map<String,Object> map);

    public void saveDatamodel(RuleDatamodel dm);

    public void updateDatamodel(RuleDatamodel ruleDatamodel);

    public void saveOrUpdateDataset(RuleDataset ruleDataset);

    public void firstDefinition(RuleDatamodel dm);

    List<RuleDataset> getDataModelListByProjectCode(String projectCode, String modelCode) throws BizException;

    void deleteDataModelById(String id) throws Exception;
    
    void deleteDataSetByIds(List<String> ids) throws Exception;
    
    void deleteDataModelPlusById(String id) throws Exception;

    List<RuleDataset> getList(RuleDataset dataset);


    /**
     * 查找数据集分页信息
     */
    PageInfo<RuleDataset> findRuleDatasetPage(Page<RuleDataset> page, RuleDataset ruleDataset);
    /**
     * 查找数据模型分页信息
     */
    PageInfo<RuleDatamodel> findRuleDatamodelPage(Page<RuleDatamodel> page, RuleDatamodel ruleDatamodel);

    PageInfo<RuleDataset> findListPageByInfo(Page<RuleDataset> page, RuleDataset ruleDataset);
    PageInfo<RuleDatamodel> findDatamodelListPageByInfo(Page<RuleDatamodel> page, RuleDatamodel ruleDatamodel);

    List<RuleDataset> queryRuleDataList(RuleDataset ruleDataset);
    List<RuleDatamodel> queryRuleDatamodelList(RuleDatamodel ruleDatamodel);

    void ToEntity(DataSourceVo vo, String projectCode);

    List<RuleDataset> findListByInfo(RuleDataset ruleDataset);

    List<RuleDataset> findDatasetList(RuleDataset ruleDataset);
    /**
     * 初始化/更新内置变量
     * @param ruleDataset
     * @return
     */
    void saveOrUpdateBuiltinParam(String code,String name,String type,String projectCode,String user);
    /**
     * 添加更新条目的优先级,权重
     * @param code
     * @param entryCode
     * @param entryname
     * @param projectCode
     */
    void saveOrUpdateEntryBuitineParam(String code,String entryCode,String name,String entryname,String projectCode);
    /**
     * 删除条目的优先级，权重
     * @param code
     * @param entryCode
     * @param entryname
     * @param projectCode
     */
    void deleteEntryBuitineParam(String code,String entryCode,String name,String entryname,String projectCode);
    /**
     * 内置变量清理
     * @param code
     * @param name
     * @param type
     * @param projectCode
     */
    public void deleteBuiltinParam(String code,String name,String type,String projectCode);

    /**
     * 更新函数变量的数据模型类型 ljt
     * @param projectCode
     */
    public void updateModelType(String projectCode);
    /**
     *  鏇存柊鏁版嵁闆嗗叧鑱攊d
     */
	void updateDMRank(RuleDataset dataset);
    /**
     * 更新关联层级ID（初始化）
     * @param condition
     * @return
     */
    int updateRankId(RuleDatamodel condition);
    
    int countList(RuleDataset condition);
    
    void deleteflag(RuleDataset ruleDataset);
	/**
	 * 移动
	 * @param ids
	 * @param nodeId
	 * @param moveType
	 */
    ResMessage move(String ids,String projectCode,String nodeId,String moveType);
    
    void  saveAndUpdateRef(RuleDataset ruleDataset) throws Exception;
	
	/**
	 *移动检查
	 * @param ids
	 * @param rankRelationId
	 * @param moveType
	 *//*
	ResMessage moveModelCheck(String id, String projectCode, List<RuleProjectRank> ranklist, String nodeId, String moveType);*/
	
	
}
